<?php

namespace app\api\model;

use app\common\model\CourseRefund as CourseRefundModel;

class CourseRefund extends CourseRefundModel
{


    /**
     * 添加记录
     */
    public function add(array $data)
    {
        return $this->allowField(true)->save($data);
    }

    /**
     * 退款详情
     */
    public static function getByRefundId($courseRefundId)
    {
        return self::with(['courseOrder' => function ($query) {
            $query->with(['teacher' => function ($query) {
                $query->withCount('course');
            }]);
        }])->find($courseRefundId);
    }
}
